package com.hui.topic;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * : 描述信息
 */
@Component
public class TopicProducer {


    @Autowired
    private AmqpTemplate amqpTemplate;


    public void send1(){
        String context = "hi, i am message 1";
        amqpTemplate.convertAndSend("topicExchange","topic.message",context);
    }


    public void send2(){
        String context = "hi, i am message 2";
        amqpTemplate.convertAndSend("topicExchange","topic.messages",context);//交换机、路邮键
    }


}

